<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>报警管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
        $(document).ready(function() {
            $("#btnExport").click(function(){
                top.$.jBox.confirm("确认要导出报警用户数据吗？","系统提示",function(v,h,f){
                    if(v=="ok"){
                        $("#searchForm").attr("action","${ctx}/sys/member/member/export");
                        $("#searchForm").submit();
                    }
                },{buttonsFocus:1});
                top.$('.jbox-body .jbox-icon').css('top','55px');
            });
            $("#btnImport").click(function(){
                $.jBox($("#importBox").html(), {title:"导入数据", buttons:{"关闭":true},
                    bottomText:"导入文件不能超过5M，仅允许导入“xls”或“xlsx”格式文件！"});
            });
            $(".kefu").click(function () {
                var id =$(this).data("id");
                layer.open({
                    type: 2,
                    title:"客户信息",
                    skin: 'layui-layer-rim', //加上边框
                    offset: ['50px', '100px'],
                    area: ['900px', '90%'], //宽高
                    content: "${ctx}/sys/member/member/checkUser?id="+id
                });

            })
            $(".tbxx").click(function () {
                var id = $(this).data("id");
                layer.open({
                    type: 2,
                    title:"备注信息查看",
                    skin: 'layui-layer-rim', //加上边框
                    offset: ['50px', '100px'],
                    area: ['800px', '60%'], //宽高
                    content: "${ctx}/sys/firm/firm/sbzd?id="+id
                });
            })
			$("#result").click(function () {
                $('#name').val("");
                $('#sex').val("");
                $('#baTime').val("");
                $('#idCard').val("");
                $('#dq').val("");
                $('#btnSubmit').click();
            })

        });
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
	<div id="importBox" class="hide">
		<form id="importForm" action="${ctx}/sys/member/member/import" method="post" enctype="multipart/form-data"
			  class="form-search" style="padding-left:20px;text-align:center;" onsubmit="loading('正在导入，请稍等...');"><br/>
			<input id="uploadFile" name="file" type="file" style="width:330px"/><br/><br/>　　
			<input id="btnImportSubmit" class="btn btn-primary" type="submit" value="   导    入   "/>
			<a href="${ctx}/sys/member/member/import/template">下载模板</a>
		</form>
	</div>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/sys/member/member/">报警列表</a></li>
		<shiro:hasPermission name="sys:member:member:edit"><li><a href="${ctx}/sys/member/member/form">报警添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="member" action="${ctx}/sys/member/member/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>姓名：</label>
				<form:input path="name" htmlEscape="false" maxlength="255" class="input-medium"/>
			</li>
			<li><label>性别：</label>
				<form:select path="sex" class="input-medium">
					<form:option value="" label=""/>
					<form:options items="${fns:getDictList('sex')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
			</li>
			<li><label>报案时间：</label>
				<input name="baTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
					value="<fmt:formatDate value="${member.baTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
			</li>
			<li><label>投保时间：</label>
				<input name="tbTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
					value="<fmt:formatDate value="${member.tbTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
			</li>
			<li><label>身份证号：</label>
				<form:input path="idCard" htmlEscape="false" maxlength="20" class="input-medium"/>
			</li>
			<li><label>地区：</label>
				<sys:treeselect id="dq" name="dq" value="${member.dqName}" labelName="" labelValue="${member.dqName}"
					title="部门" url="/sys/office/treeData?type=2" cssClass="input-small" allowClear="true" notAllowSelectParent="true"/>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
				               <input id="result" class="btn btn-primary" type="button" value="重置"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
								<input id="btnExport" class="btn btn-primary" type="button" value="导出"/>
				                <%--<button  id="btnExport" class="layui-btn layui-btn-radius layui-btn-warm">导出</button>--%>
								<input id="btnImport" class="btn btn-primary" type="button" value="导入"/></li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>姓名</th>
				<th>性别</th>
				<th>年龄</th>
				<th>电话号码</th>
				<th>报案时间</th>
				<th>投保时间</th>
				<th>身份证号</th>
				<th>地区</th>
				<th>备注信息</th>
				<shiro:hasPermission name="sys:member:member:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="member">
			<tr>
				<td><a href="${ctx}/sys/member/member/form?id=${member.id}">
					${member.name}
				</a></td>
				<td>
					${fns:getDictLabel(member.sex, 'sex', '')}
				</td>
				<td>
						${member.age}
				</td>
				<td>
						${member.phone}&nbsp;&nbsp;<c:if test="${not empty member.phone}">(${fns:getdq(member.phone)})</c:if>
				</td>
				<td>
					<fmt:formatDate value="${member.baTime}" pattern="yyyy-MM-dd"/>
				</td>
				<td>
					<fmt:formatDate value="${member.tbTime}" pattern="yyyy-MM-dd"/>
				</td>
				<td id="idCard">
						${member.idCard}<c:if test="${not empty member.idCard}">[${fns:getIdArea(member.idCard)}]</c:if>
				</td>
				<td>
					${member.dqName}
				</td>
				<td><a href="#" href="javascript:void(0)" class="tbxx" data-id=${member.id}>
					<div style="white-space: nowrap;overflow:hidden;width:80px;height: 20px;">
					${member.remarks}
					</div></div>
				</td>
				<shiro:hasPermission name="sys:member:member:edit"><td>
    				<a href="${ctx}/sys/member/member/form?id=${member.id}">修改</a>
					<a href="${ctx}/sys/member/member/delete?id=${member.id}" onclick="return confirmx('确认要删除该报警吗？', this.href)">删除</a>
					<a href="javascript:void(0)" class="kefu" data-id=${member.id}>设定客服</a>
					<%--<a href="${ctx}/sys/member/member/checkKf?id=${member.id}">设定客服</a>--%>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>